function reset(){
    mypwdform.form.reset();
};

function surely() {
    if(mypwdform.getForm().isValid())
    {
        mypwdform.form.submit({
            waitMsg : '正在提交信息......',
            url : '/user/chgpwd.action',
            timeout: 3000,
            success : function(form, action) {
                Ext.MessageBox.hide();
                Ext.MessageBox.alert('信息', action.result.msg);
                form.reset();
            },
            failure : function(form, action) {
                Ext.MessageBox.hide();
                Ext.MessageBox.alert('警告', action.result.msg);
                form.reset();
            }
        });
    }
};
var mypwdform = new Ext.form.FormPanel({
       width:350,
	   align : 'center',
       frame:true,
       labelWidth:80,
       bodyStyle:"padding:5px 5px 0",
       defaults:{width:150,xtype:"textfield",inputType:"password"},
       method:'POST',
		items:[{fieldLabel:"原密码",
	            id:"oldPwd",
	            name:'oldPwd',
	            anchor:"90%",
	            blankText : '原密码不能为空',
	            inputType : 'password'
	           },{fieldLabel:"新密码",
	           	id:"newPwd",
	            name:"newPwd",
	            anchor:"90%",
	            blankText : '新密码不能为空',
	            inputType : 'password'
	           },{
	            fieldLabel:"确认密码",
	            id:"rePwd",
	            name:'rePwd',
	            vtype:"password",//自定义的验证类型
	            vtypeText:"两次密码不一致！",
	            confirmTo:"newPwd",//要比较的另外一个的组件的id
	            anchor:"90%",
	            blankText : '确认密码不能为空',
	            inputType : 'password'
	           }],
	           buttons:[
	            {
	                text:'确定',
	                id:'sure',
	                handler:surely
	            },
	            {
	                text:'重置',
	                id:'clear',
	                handler:reset
	            }]
		    });
var p_pwd = {
	id : 'pwd-panel',
	title:"修改密码",
	border : false,
	layout : 'border',
	items : [mypwdform]
};